import { Controller, Get, Post, Body, Query } from '@nestjs/common';
import { DesignService } from './design.service';
import { CreateDesignDto } from './dto/create-design.dto';
import { UpdateDesignDto } from './dto/update-design.dto';

@Controller('design')
export class DesignController {
  constructor(private readonly designService: DesignService) {}

  @Post('/create')
  create(@Body() createDesignDto: CreateDesignDto) {
    return this.designService.create(createDesignDto);
  }

  @Get('/findAll')
  findAll() {
    console.log(new Date());
    return this.designService.findAll();
  }

  @Get('/findOne')
  findOne(@Query('id') id: string) {
    console.log(id);
    return this.designService.findOne(id);
  }

  @Post('/update')
  update(@Body() updateDesignDto: UpdateDesignDto) {
    return this.designService.update(updateDesignDto);
  }

  @Get('/deleteOne')
  remove(@Query('id') id: string) {
    return this.designService.remove(id);
  }

  @Post('/saveAll')
  saveAll(@Body() createDesignDto: CreateDesignDto) {
    return this.designService.saveAll(createDesignDto);
  }
}
